package cn.cew.bytespyserver.page;

import lombok.Data;

/**
 * @author chenenwei
 * @version 1.0.0
 * @description TODO
 * @createTime 2022-10-13 10:51:00
 */
@Data
public class ApiResponse<T> {

    private String code;
    private String message;
    private T data;


    public ApiResponse ( String message) {
        this.message = message;
    }

    public ApiResponse (String code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static  <T> ApiResponse success (T data) {
        return new ApiResponse("0", "success", data);
    }

    public static  <T> ApiResponse error (String msg) {
        return new ApiResponse("-1", msg, null);
    }
}
